package com.leokok.jts.learning.jts.core.algorithm;

import org.junit.Test;
import org.locationtech.jts.algorithm.PointLocation;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;

public class PointLocationTest {

    @Test
    public void isOnLine() throws ParseException {
        WKTReader wktReader = new WKTReader();
        Geometry geometry = wktReader.read("LINESTRING (115.926976 31.988883, 115.926 31.9888, 115.927028 31.988898, 115.927049 31.988905, 115.927075 31.988912, 115.9271 31.988916)");

        Coordinate coordinate = new Coordinate(115.9270068635995, 31.988890499987);

        System.out.println(PointLocation.isOnLine(coordinate, geometry.getCoordinates()));
    }
}
